package com.wk.jetpackdemo.entities

import android.arch.persistence.room.ColumnInfo
import android.arch.persistence.room.Entity
import android.arch.persistence.room.PrimaryKey
import java.io.Serializable

/**
 * 页面描述：用户
 *
 * Created by ditclear on 2017/9/26.
 */

@Entity(tableName = "pao_users")
class User :Serializable{
    /**
     * id : 14161
     * nickname : fxx
     * face : http://www.jcodecraeer.com/plugin/Identicon/index.php?string=fxx&size=60
     * sex : 男
     * position :
     * city :
     * company :
     * education :
     * logindate : 2017-08-14 23:31:03
     * signdate : 2017-08-14 08:50:08
     * qianming : 还木有签名哦
     * fans : 0
     * guanzhu : 0
     */
    @PrimaryKey
    @ColumnInfo(name = "userid")
    var id: Int = 0

    var nickname: String? = null
    var face: String? = null
    var sex: String? = null
    var position: String? = null
    var city: String? = null
    var company: String? = null
    var education: String? = null
    var logindate: String? = null
    var signdate: String? = null
    var qianming: String? = null
    var fans: Int = 0
    var guanzhu: Int = 0
    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (javaClass != other?.javaClass) return false

        other as User

        if (id != other.id) return false
        if (nickname != other.nickname) return false
        if (face != other.face) return false
        if (sex != other.sex) return false
        if (position != other.position) return false
        if (city != other.city) return false
        if (company != other.company) return false
        if (education != other.education) return false
        if (logindate != other.logindate) return false
        if (signdate != other.signdate) return false
        if (qianming != other.qianming) return false
        if (fans != other.fans) return false
        if (guanzhu != other.guanzhu) return false

        return true
    }

    override fun hashCode(): Int {
        var result = id
        result = 31 * result + (nickname?.hashCode() ?: 0)
        result = 31 * result + (face?.hashCode() ?: 0)
        result = 31 * result + (sex?.hashCode() ?: 0)
        result = 31 * result + (position?.hashCode() ?: 0)
        result = 31 * result + (city?.hashCode() ?: 0)
        result = 31 * result + (company?.hashCode() ?: 0)
        result = 31 * result + (education?.hashCode() ?: 0)
        result = 31 * result + (logindate?.hashCode() ?: 0)
        result = 31 * result + (signdate?.hashCode() ?: 0)
        result = 31 * result + (qianming?.hashCode() ?: 0)
        result = 31 * result + fans
        result = 31 * result + guanzhu
        return result
    }


}
